import random
import string
from datetime import datetime

def generate_order_number():
    """生成订单号"""
    date_str = datetime.now().strftime('%Y%m%d%H%M%S')
    random_str = ''.join(random.choices(string.digits, k=6))
    return f"OD{date_str}{random_str}"

def calculate_order_amount(items):
    """计算订单总金额"""
    total = 0
    for item in items:
        total += item['price'] * item['quantity']
    return total 